package com.explorati.design_pattern.behavior.mediator.example;

/**
 * 抽象中介者(Mediator)角色：该角色定义出同事对象到中介者对象的同一接口
 * 
 * @author explorati
 *
 */
public abstract class Person {

	String name;// 姓名
	int age;// 年龄
	Sex sex;// 性别
	int requestAge;// 要求对象的年龄。对对象只有这一个要求
	MarriageAgency agency;// 婚姻中介

	public Person(String name, int age, Sex sex, int requestAge, MarriageAgency agency) {
		this.name = name;
		this.age = age;
		this.sex = sex;
		this.requestAge = requestAge;
		this.agency = agency;
		agency.register(this);
	}

	// 寻找对象
	public void findPartner() {
		agency.pair(this);
	}

}

enum Sex {
	MALE, FEMALE;
}
